import logging,yagmail,HTMLTestRunner_cn,pytest,time

class Tools():
    def Log(self):
        t = time.strftime('%Y_%m_%d_%H_%M_%S')
        log = logging.basicConfig(level=logging.DEBUG,filename=t+'A3mall.log',filemode='%(levename)s %(message)s %(lengname)s %(mengname)s %(lenone)d')
        return log

    def BaoGao(self):
        baogao = HTMLTestRunner_cn.HTMLTestRunner(open('TestCase.py','w'),title='A3mall测试报告',description='A3mall购物车测试报告')
        return baogao

    def Email(self):
        t = time.strftime('%Y_%m_%d_%H_%M_%S')
        email = yagmail.SMTP(user='3484055372@qq.com',password='Ngqyabdsctyocigf',host='smtp.qq.com')
        email.send(to='3484055372@qq.com',attachments=t+'A3mall购物车测试报告',subject=t+'A3mall购物车测试报告')

        return email



if __name__ == '__main__':
   #Tools().Log()
    pytest.main([r'E:\gaowu_2303A\Rk\zk9_29\TestCase.py','-s','--html=A3mall.html'])
    Tools().Email()